package band.wukong.practice.javase.core.util;

import java.util.Date;

/**
 * Description:
 * Author: jsun
 * Date: 2010-1-29 8:46:41
 */
public class TestDate {
    public static void main(String[] args) {
        //---------------------------------------------
        Date d1 = new Date(System.currentTimeMillis());
		Date d2 = new Date();
		System.out.println("d1 = " + d1);
		System.out.println("d2 = " + d2);


        //---------------------------------------------
        Date date = new Date();
        long l = date.getTime();

        System.out.println("date = " + date);
        System.out.println("date.getTime() = " + date.getTime());
        
        System.out.println("new Date(l) = " + new Date(l));
        System.out.println("new Date(l).getTime() = " + new Date(l).getTime());


        //---------------------------------------------
        //区别java.util.Date和java.sql.Date
        java.util.Date utilDate = new java.util.Date();
        System.out.println("utilDate = " + utilDate.toLocaleString());
        System.out.println("utilDate.getTime() = " + utilDate.getTime());

        java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
        System.out.println("sqlDate = " + sqlDate);
        System.out.println("sqlDate.toGMTString() = " + sqlDate.toLocaleString());

        utilDate = new java.sql.Date(System.currentTimeMillis());
        System.out.println("utilDate.getTime() = " + utilDate.getTime());
    }
}
